﻿using log4net;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using WpfAGVSystem.Model;

namespace WpfAGVSystem.ViewModels
{
    public class LogViewModel : BindableBase,IDialogAware
    {
        public AGVModel agvmodel { get; set; }
        public List<string> log { get; set; }=new List<string>();
        public LogViewModel()
        {
         
        }

        public string Title => $"AGV{agvmodel.Deviceid}:日志信息";

        public event Action<IDialogResult> RequestClose;
        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {
            //throw new NotImplementedException();
        }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            agvmodel = parameters.GetValue<AGVModel>("agvmodel");

            //lock ("PushLock")
            //{
            //    foreach (var item in agvmodel.LogClass.Logs)
            //    {
            //        log.Add((string)item.Clone());
            //    }
            //}
            //throw new NotImplementedException();
        }
    }
}
